home *** CD-ROM | disk | FTP | other *** search
- package arka;
-
- import java.io.IOException;
- import javax.microedition.lcdui.Canvas;
- import javax.microedition.lcdui.Font;
- import javax.microedition.lcdui.Graphics;
- import javax.microedition.lcdui.Image;
-
- public class Displayable2 extends Canvas {
- Image dbimage;
- Image dbimage1;
- Image background;
- Image ball;
- Image board;
- Image stick;
- Image dust;
- Image die;
- Image die2;
- Image pause;
- Image soundim;
- Image ico;
- Image[] fly = new Image[13];
- Graphics dbg;
- Graphics dbg1;
- Image[] brick = new Image[5];
- Image[] number = new Image[10];
- int di1;
- int di2;
- int di3;
- // $FF: renamed from: bx int
- int field_0;
- // $FF: renamed from: by int
- int field_1;
- int bmovex;
- int bmovey;
- // $FF: renamed from: f1 int
- int field_2;
- int fx1;
- int fy1;
- int fmovex1;
- int fmovey1;
- int dx1;
- int dy1;
- // $FF: renamed from: f2 int
- int field_3;
- int fx2;
- int fy2;
- int fmovex2;
- int fmovey2;
- int dx2;
- int dy2;
- // $FF: renamed from: f3 int
- int field_4;
- int fx3;
- int fy3;
- int fmovex3;
- int fmovey3;
- int dx3;
- int dy3;
- // $FF: renamed from: sy int
- int field_5;
- int smovey;
- int score;
- int lives;
- int level;
- int bricks;
- int cx1;
- int cy1;
- int cx2;
- int cy2;
- int cr1;
- int cr2;
- boolean crash1;
- boolean crash2;
- boolean newlevel;
- boolean death1;
- boolean death2;
- boolean death3;
- boolean dieing1;
- boolean dieing2;
- boolean dieing3;
- boolean paused;
-
- public Displayable2() {
- try {
- this.jbInit();
- } catch (Exception e) {
- ((Throwable)e).printStackTrace();
- }
-
- }
-
- private void jbInit() throws Exception {
- try {
- this.background = Image.createImage("/arka/arkanoid.png");
- this.ball = Image.createImage("/arka/ball.png");
- this.board = Image.createImage("/arka/board.png");
- this.stick = Image.createImage("/arka/stick.png");
- this.dust = Image.createImage("/arka/dust.png");
- this.die = Image.createImage("/arka/die.png");
- this.die2 = Image.createImage("/arka/die2.png");
- this.pause = Image.createImage("/arka/pause.png");
- this.soundim = Image.createImage("/arka/sound.png");
- this.brick[0] = Image.createImage("/arka/brick0.png");
- this.brick[1] = Image.createImage("/arka/brick1.png");
- this.brick[2] = Image.createImage("/arka/brick2.png");
- this.brick[3] = Image.createImage("/arka/brick3.png");
- this.number[0] = Image.createImage("/arka/0.png");
- this.number[1] = Image.createImage("/arka/1.png");
- this.number[2] = Image.createImage("/arka/2.png");
- this.number[3] = Image.createImage("/arka/3.png");
- this.number[4] = Image.createImage("/arka/4.png");
- this.number[5] = Image.createImage("/arka/5.png");
- this.number[6] = Image.createImage("/arka/6.png");
- this.number[7] = Image.createImage("/arka/7.png");
- this.number[8] = Image.createImage("/arka/8.png");
- this.number[9] = Image.createImage("/arka/9.png");
- this.fly[0] = Image.createImage("/arka/fly0.png");
- this.fly[1] = Image.createImage("/arka/fly1.png");
- this.fly[2] = Image.createImage("/arka/fly2.png");
- this.fly[3] = Image.createImage("/arka/fly3.png");
- this.fly[4] = Image.createImage("/arka/fly4.png");
- this.fly[5] = Image.createImage("/arka/fly6.png");
- this.fly[6] = Image.createImage("/arka/fly5.png");
- this.fly[7] = Image.createImage("/arka/fly6.png");
- this.fly[8] = Image.createImage("/arka/fly7.png");
- this.fly[9] = Image.createImage("/arka/fly8.png");
- this.fly[10] = Image.createImage("/arka/fly7.png");
- this.fly[11] = Image.createImage("/arka/fly9.png");
- this.fly[12] = Image.createImage("/arka/fly10.png");
- this.ico = Image.createImage("/arka/ico.png");
- } catch (IOException e) {
- System.out.println(((Throwable)e).getMessage());
- }
-
- this.cr1 = 0;
- this.cr2 = 0;
- this.smovey = 0;
- this.field_0 = 10;
- this.field_1 = 10;
- this.bmovex = 1;
- this.bmovey = 1;
- this.di1 = 0;
- this.di2 = 0;
- this.di3 = 0;
- this.score = 0;
- this.lives = 3;
- this.level = 1;
- this.field_2 = 0;
- this.field_3 = 0;
- this.crash1 = false;
- this.crash2 = false;
- this.newlevel = false;
- this.dieing1 = false;
- this.dieing2 = false;
- this.dieing3 = false;
- this.paused = false;
- this.dbimage1 = Image.createImage(96, 64);
- this.dbg1 = this.dbimage1.getGraphics();
- this.dbg1.setColor(255, 255, 255);
- Font.getFont(0, 0, 8);
- }
-
- protected void keyPressed(int keyCode) {
- if (keyCode == -1 || keyCode == 49 || keyCode == 50) {
- this.smovey = -2;
- }
-
- if (keyCode == -2 || keyCode == 51 || keyCode == 53) {
- this.smovey = 2;
- }
-
- if (this.bmovex == 0) {
- this.bmovex = -1;
- if (this.smovey != 0) {
- this.bmovey = this.smovey / 2;
- } else {
- this.bmovey = 1;
- }
- }
-
- if (keyCode == 48) {
- MIDlet1.pauseGame();
- }
-
- if (keyCode == 56) {
- if (this.paused) {
- this.paused = false;
- } else {
- this.paused = true;
- }
- }
-
- }
-
- protected void keyReleased(int keyCode) {
- if (keyCode == -1 || keyCode == 49 || keyCode == 50) {
- this.smovey = 0;
- }
-
- if (keyCode == -2 || keyCode == 51 || keyCode == 53) {
- this.smovey = 0;
- }
-
- }
-
- protected void paint(Graphics g) {
- if (this.crash1) {
- ++this.cr1;
- this.dbg1.drawImage(this.dust, this.cx1, this.cy1, 20);
- if (this.cr1 > 2) {
- this.cr1 = 0;
- this.score += 10;
- this.crash1 = false;
- this.dbg1.fillRect(this.cx1, this.cy1, 5, 4);
- --this.bricks;
- if (this.bricks == 0) {
- ++this.level;
- this.newlevel = true;
- }
- }
- }
-
- if (this.crash2) {
- ++this.cr2;
- this.dbg1.drawImage(this.dust, this.cx2, this.cy2, 20);
- if (this.cr2 > 2) {
- this.cr2 = 0;
- this.score += 10;
- this.crash2 = false;
- this.dbg1.fillRect(this.cx2, this.cy2, 5, 4);
- --this.bricks;
- if (this.bricks == 0) {
- ++this.level;
- this.newlevel = true;
- }
- }
- }
-
- g.drawImage(this.dbimage1, 0, 0, 20);
- g.drawImage(this.stick, 89, this.field_5, 20);
- g.drawImage(this.ball, this.field_0 - 2, this.field_1 - 1, 20);
- if (!this.death1) {
- g.drawImage(this.fly[this.field_2], this.fx1 - 2, this.fy1 - 2, 20);
- }
-
- if (this.dieing1) {
- ++this.di1;
- if (this.di1 < 4) {
- g.drawImage(this.die, this.fx1 - 3, this.fy1 - 3, 20);
- } else {
- g.drawImage(this.die2, this.fx1 - 3, this.fy1 - 3, 20);
- }
-
- if (this.di1 > 7) {
- this.di1 = 0;
- this.dieing1 = false;
- }
- }
-
- if (!this.death2) {
- g.drawImage(this.fly[this.field_3 + 5], this.fx2 - 2, this.fy2 - 2, 20);
- }
-
- if (this.dieing2) {
- ++this.di2;
- if (this.di2 < 4) {
- g.drawImage(this.die, this.fx2 - 3, this.fy2 - 3, 20);
- } else {
- g.drawImage(this.die2, this.fx2 - 3, this.fy2 - 3, 20);
- }
-
- if (this.di2 > 7) {
- this.di2 = 0;
- this.dieing2 = false;
- }
- }
-
- if (!this.death3) {
- g.drawImage(this.fly[this.field_4 + 11], this.fx3 - 2, this.fy3 - 2, 20);
- }
-
- if (this.dieing3) {
- ++this.di3;
- if (this.di3 < 4) {
- g.drawImage(this.die, this.fx3 - 3, this.fy3 - 3, 20);
- } else {
- g.drawImage(this.die2, this.fx3 - 3, this.fy3 - 3, 20);
- }
-
- if (this.di3 > 7) {
- this.di3 = 0;
- this.dieing3 = false;
- }
- }
-
- g.drawImage(this.board, 9, 56, 20);
- g.drawImage(this.number[0], 77, 58, 20);
- g.drawImage(this.number[this.score / 10 - this.score / 100 * 10], 72, 58, 20);
- g.drawImage(this.number[this.score / 100 - this.score / 1000 * 10], 67, 58, 20);
- g.drawImage(this.number[this.score / 1000 - this.score / 10000 * 10], 62, 58, 20);
- g.drawImage(this.number[this.score / 10000 - this.score / 100000 * 10], 57, 58, 20);
- g.drawImage(this.number[this.lives], 41, 58, 20);
- g.drawImage(this.number[this.level / 10 - this.level / 100 * 10], 18, 58, 20);
- g.drawImage(this.number[this.level - this.level / 10], 23, 58, 20);
- if (this.paused) {
- g.drawImage(this.pause, 28, 25, 20);
- }
-
- }
- }
-